package com.jeasonzhao.report.engine.impl;

import com.jeasonzhao.commons.utils.Algorithms;
import com.jeasonzhao.report.msg.LocalizationManager;
import com.jeasonzhao.report.msg.Message;

public class DataSetProviderMessage
{
    private DataSetProviderMessage()
    {
    }

    @Message(encode = "zh_cn:正在准备SQL语句 {0}...;en:Preparing SQL statments {0}...;")
    public static final String MESSAGE_PREPARE_SQL = "MESSAGE_PREPARE_SQL";

    @Message(encode = "zh_cn:找不到数据库连接{0}...;en:Could Not found the database configuration by Id={0}...;")
    public static final String MESSAGE_NO_DATABASE_BY_ID = "MESSAGE_NO_DATABASE_BY_ID";

    @Message(encode = "zh_cn:正在准备连接数据{0}...;en:Connecting database {0}...;")
    public static final String MESSAGE_CONNECTING = "MESSAGE_CONNECTING";

    @Message(encode = "zh_cn:正在执行SQL...;en:Executing SQL statement...;")
    public static final String MESSAGE_EXECUTING = "MESSAGE_EXECUTING";

    @Message(encode = "zh_cn:类{0}找不到默认的构造函数;en:No default constructor could be found in {0};")
    public static final String MESSAGE_NO_DEFAULT_CONSTRUCTOR = "MESSAGE_NO_DEFAULT_CONSTRUCTOR";

    @Message(encode = "zh_cn:关键字{0}已经被{1}注册;en:The keyword {0} has been registerred by {1};")
    public static final String KEY_HAS_BEEN_REGISTERED = "KEY_HAS_BEEN_REGISTERED";

    public static final String get(String key)
    {
        return LocalizationManager.getInstance().get(DataSetProviderMessage.class,key);
    }

    public static final String format(String key,Object ...parameter)
    {
        return Algorithms.replaceStringByPosition(LocalizationManager.getInstance()
                                                  .get(DataSetProviderMessage.class,key),parameter);
    }

}
